Skip to content

Prevent parallel login flows after logout#1410

Merged
julien-nc merged 6 commits intomainfrom
fix/noid/only-redirect-navigation-requests
Apr 17, 2026
Merged

Prevent parallel login flows after logout#1410
julien-nc merged 6 commits intomainfrom
fix/noid/only-redirect-navigation-requests

Conversation

@julien-nc
Copy link
Copy Markdown
Member

@julien-nc julien-nc commented Apr 10, 2026

Global problem: When the user is logged out (by user_oidc or anything else like integration_swp), user_oidc might try to redirect to the start of an Oidc login flow. This can lead to parallel login flows messing with each other (state mismatch) if all requests are redirected.

This can happen:

  • after a logout, if allow_multiple_user_backends is set to 0 and there is only one provider, any request to /login will redirect to the user_oidc.login.login route
  • if store_login_token is enabled and a token expires, we reach TokenService::reauthenticate which logs out and redirects to the store_login_token

Solution in this PR: Only redirect to the login flow when the request comes from a 'navigation' context.

This is an alternative to #1409 which is possibly better.

@julien-nc julien-nc requested a review from CarlSchwan April 10, 2026 14:22
@julien-nc julien-nc added bug Something isn't working 3. to review labels Apr 10, 2026
@julien-nc julien-nc force-pushed the fix/noid/only-redirect-navigation-requests branch 2 times, most recently from 88247a9 to 4a3e72b Compare April 15, 2026 11:02
…avigation' context

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc force-pushed the fix/noid/only-redirect-navigation-requests branch from 4a3e72b to 2a7b869 Compare April 16, 2026 15:01
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
…so, redirect to the redirect URL and do nothing

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Comment on lines +24 to +28
if ($request->getHeader('X-Requested-With') === 'XMLHttpRequest') {
return false;
}

return true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($request->getHeader('X-Requested-With') === 'XMLHttpRequest') {
return false;
}
return true;
return $request->getHeader('X-Requested-With') !== 'XMLHttpRequest');

@julien-nc julien-nc marked this pull request as ready for review April 17, 2026 08:37
@julien-nc julien-nc merged commit 8194adf into main Apr 17, 2026
46 checks passed
@julien-nc julien-nc deleted the fix/noid/only-redirect-navigation-requests branch April 17, 2026 08:38
@julien-nc julien-nc mentioned this pull request Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants